package com.eight.paper.admin.service;

import com.eight.common.core.domain.TreeSelect;
import com.eight.common.core.domain.entity.QuestionRepo;

import java.util.List;

/**
 * 试题题库章节Service接口
 * 
 * @author eight
 * @date 2023-10-11
 */
public interface IQuestionRepoService 
{
    /**
     * 查询试题题库章节
     * 
     * @param repoId 试题题库章节主键
     * @return 试题题库章节
     */
    public QuestionRepo selectQuestionRepoByRepoId(Long repoId);

    /**
     * 查询试题题库章节列表
     * 
     * @param questionRepo 试题题库章节
     * @return 试题题库章节集合
     */
    public List<QuestionRepo> selectQuestionRepoList(QuestionRepo questionRepo);

    /**
     * 新增试题题库章节
     * 
     * @param questionRepo 试题题库章节
     * @return 结果
     */
    public int insertQuestionRepo(QuestionRepo questionRepo);

    /**
     * 修改试题题库章节
     * 
     * @param questionRepo 试题题库章节
     * @return 结果
     */
    public int updateQuestionRepo(QuestionRepo questionRepo);


    /**
     * 删除试题题库章节信息
     * 
     * @param repoId 试题题库章节主键
     * @return 结果
     */
    public int deleteQuestionRepoByRepoId(Long repoId);

    /**
     * 检查题库章节名称是否唯一
     * @param questionRepo
     * @return
     */
    boolean checkRepoNameUnique(QuestionRepo questionRepo);

    /**
     * 根据ID查询所有子章节（正常状态）
     *
     * @param repoId 题库章节ID
     * @return 子章节数
     */
    int selectNormalChildrenRepoById(Long repoId);

    /**
     * 是否存在章节子节点
     *
     * @param repoId 部门ID
     * @return 结果
     */
    boolean hasChildByRepoId(Long repoId);

    /**
     * 是否存在试题
     * @param repoId
     * @return
     */
    boolean checkRepotExistQuestion(Long repoId);

    /**
     * 查询试题题库章节列表
     *
     * @param repo 试题题库章节
     * @return 试题题库章节
     */
    List<TreeSelect> selectRepoTreeList(QuestionRepo repo);

}
